<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <script>
        function reloadImage(e) {
            let img = document.querySelector("#img");
            img.src = "/shop/pngImg.php?t=" + new Date().getTime();
        }

        function checkLogin() {
            // TODO: 参数的格式验证
            return true;
        }
    </script>
</head>
<body>
    <h2>登录</h2>
    <div style="color:red;font-size: 24px;" ><?= $_REQUEST["msg"] ?></div>
    <form action="/shop/login.php" method="post" onsubmit="return checkLogin()">
        <div>
            <label>登录名: <input type="text" name="loginName"></label>
        </div>
        <div>
            <label>密码: <input type="password" name="password"></label>
        </div>
        <div>
            <label>
                <span>验证码:</span>
                <input type="text" name="userCode">
            </label>
            <label onclick="reloadImage()" title="点击刷新验证码" >
            <img id="img" style="vertical-align: top;" src="/shop/pngImg.php" alt="验证码加载失败" /></label>
        </div>
        <div>
            <input type="submit" value="登录">
        </div>
    </form>
    <div>
        <a href="/shop/registerPage.php">没有账户? 去注册</a>
    </div>
</body>
</html>